package User

import (
	"net/http"

	"ICan/SDK"
	M "ICan/MySql"
	"ICan/errmsg"
	_ "github.com/go-sql-driver/mysql"
	"github.com/gin-gonic/gin"
)
var yan4 string = "000000"

func Delete(ctx *gin.Context){
	ver := ctx.PostForm("verification")
	if ver == yan4 {
		code := errmsg.Succse
		data := map[string]interface{}{
			"code":code,
			"msg":errmsg.GetErrMSg(code),
		}
		ctx.JSON(http.StatusOK, data)
	}else {
		code := errmsg.Error_ver
		data := map[string]interface{}{
			"code":code,
			"msg":errmsg.GetErrMSg(code),
		}
		ctx.JSON(http.StatusOK, data)
	}
}
func F5(ctx *gin.Context){
	user_phone := ctx.PostForm("user_phone")
	sqlstr := `select user_id from user where user_phone = ?`
	rowObj := M.Db.QueryRow(sqlstr, user_phone)
	var u user
	rowObj.Scan(&u.User_id)
	if u.User_id > 0 {
		yan4 = SDK.SDK4(user_phone )
		code :=  errmsg.Succse
		data := map[string]interface{}{
			"code":code,
			"msg":errmsg.GetErrMSg(code),
		}
		ctx.JSON(http.StatusOK,data)
	}else {
		code :=  errmsg.Error_phone_ver
		data := map[string]interface{}{
			"code":code,
			"msg":errmsg.GetErrMSg(code),
		}
		ctx.JSON(http.StatusOK,data)
	}
}